<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
	<title>Fancytree - Example: Persist</title>

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
	<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript"></script>

	<link href="../src/skin-win7/ui.fancytree.css" rel="stylesheet" type="text/css">
	<script src="../src/jquery.fancytree.js" type="text/javascript"></script>
	<script src="../lib/jquery.cookie.js" type="text/javascript"></script>

	<script src="../src/jquery.fancytree.persist.js" type="text/javascript"></script>

	<!-- Start_Exclude: This block is not part of the sample code -->
	<link href="../lib/prettify.css" rel="stylesheet">
	<script src="../lib/prettify.js" type="text/javascript"></script>
	<link href="sample.css" rel="stylesheet" type="text/css">
	<script src="sample.js" type="text/javascript"></script>
	<!-- End_Exclude -->

<style type="text/css">
</style>

<!-- Add code to initialize the tree when the document is loaded: -->
<script type="text/javascript">
	$(function(){
		// Attach the fancytree widget to an existing <div id="tree"> element
		// and pass the tree options as an argument to the fancytree() function:
		$("#tree").fancytree({
			extensions: ["persist"],
			checkbox: true,
			source: {
				url: "ajax-tree-plain.json"
			},
			persist: {
//				mode: "hide"
			},
			// don't use this in production code:
			ajax: {
				debugLazyDelay: [200, 1000]
			},
			activate: function(e, data) {
//				alert("activate " + data.node);
			},
			lazyload: function(e, data) {
				data.result = {url: "ajax-sub2.json"}
			}
		});
		var tree = $("#tree").fancytree("getTree");

		$("button#btnReset").click(function(e){
			tree.clearCookies();
		});

		$("input#hideMode").change(function(e){
			tree.options.filter.mode = $(this).is(":checked") ? "hide" : "dimm";
			tree.clearFilter();
			$("input[name=search]").keyup();
//			tree.render();
		});
	});
</script>
</head>
<body class="example">
	<h1>Example: 'persist' extension</h1>
	<div class="description">
		This sample shows cookie persistence support.<br>
		Set options - click, expand and select nodes - press [F5] to reload.
	</div>
	<div>
		<label for="skinswitcher">Skin:</label> <select id="skinswitcher"></select>
	</div>
	<p>
		<fieldset>
			<legend>Choose persistent data types</legend>
			<label><input type="checkbox" name="active"> Active node</label>
			<label><input type="checkbox" name="selected"> Selected nodes</label>
		</fieldset>
		<button id="btnReset">Reset cookie</button>
	</p>
	<!-- Add a <table> element where the tree should appear: -->
	<div id="tree">
	</div>

	<!-- Start_Exclude: This block is not part of the sample code -->
	<hr>
	<p class="sample-links  no_code">
		<a class="hideInsideFS" href="http://fancytree.googlecode.com">jquery.fancytree.js project home</a>
		<a class="hideOutsideFS" href="#">Link to this page</a>
		<a class="hideInsideFS" href="index.html">Example Browser</a>
		<a href="#" id="codeExample">View source code</a>
	</p>
	<pre id="sourceCode" class="prettyprint" style="display:none"></pre>
	<!-- End_Exclude -->
</body>
</html>
